<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions'%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>linkbox</title>
<link rel="stylesheet" type="text/css" href="./css/global.css" />
</head>

<body>
    <div class="pageBox">
        <h1><spring:message code="links.existingLinks" />:</h1>
        <c:choose>
            <c:when test="${fn:length(existingLinks) > 0}">
                <c:forEach items="${existingLinks}" var="link" varStatus="loopStatus">
                    ${loopStatus.count}: <a href="${link.address}">${link.name}</a><br />
                </c:forEach>
            </c:when>
            <c:otherwise><spring:message code="general.nones" /></c:otherwise>
        </c:choose>

	    <p><spring:message code="links.addLink" />:</p>
		<form:form method="POST" modelAttribute="link"
			action="./link-management">
			<form:input path="name" /> <spring:message code="general.name" /><br />
			<form:input path="address" /> <spring:message code="general.address" /><br />
			<input type="submit" value="<spring:message code="actions.add" />" />
		</form:form>
	</div>
</body>

</html>